package com.tgy.赫夫曼树;

/***
 * @ClassName: Node
 * @Description: 赫夫曼树的节点
 * 为了让Node 对象持续排序Collections集合排序
 *  让Node 实现Comparable接口
 * @Auther: tanggy3
 * @Date: 10:16 2023/2/15
 * @version : V1.0
 */
public class Node  {
    private int value;
    private Node left;
    private Node right;


    public Node(int value, Node left, Node right) {
        this.value = value;
        this.left = left;
        this.right = right;
    }

    public Node() {
    }

    public Node(int value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "Node [value=" + value + "]";
    }

    public int getValue() {
        return value;
    }

    public Node setValue(int value) {
        this.value = value;
        return this;
    }

    public Node getLeft() {
        return left;
    }

    public Node setLeft(Node left) {
        this.left = left;
        return this;
    }

    public Node getRight() {
        return right;
    }

    public Node setRight(Node right) {
        this.right = right;
        return this;
    }

//    @Override
//    public int compareTo(Node node) {
//        // 表示从小到大排序
//        return this.value - node.value;
//        //return node.value - this.value;
//        //return (this.getValue() < node.getValue()) ? -1 : (this.getValue() ==  node.getValue()) ? 0 : 1;
//        //return this.compareTo(node);
//    }
}
